<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui" template="template.xhtml">

	<ui:define name="main">
		<div class="header header_professor" />
		<h:form id="formCadastroProfessor">
			<p:fieldset legend="#{msgs.dados_pessoais}">
				<p:ajaxStatus id="ajaxWait"
					style="position:absolute;margin-top:-17px;margin-left:43%;z-index:9;">
					<f:facet name="start">
						<h:graphicImage value="images/aguarde.gif" />
					</f:facet>
					<f:facet name="complete">
						<h:outputText value="" />
					</f:facet>
				</p:ajaxStatus>
				<h:panelGrid columns="3" width="90%">
					<h:outputLabel value="#{msgs.nome}#{msgs.dois_pontos}" />
					<h:outputLabel value="#{msgs.data_nascimento}#{msgs.dois_pontos}"
						style="margin-right:135px" />
					<h:panelGroup />
					<p:inputText id="nome" value="#{professorBean.professor.nome}"
						maxlength="70" size="50" required="true">
						<p:message for="nome" />
					</p:inputText>
					<p:calendar id="dataNasc"
						value="#{professorBean.professor.dataNasc}" locale="pt_Br"
						navigator="true" showButtonPanel="true" required="true">
						<p:message for="dataNasc" />
					</p:calendar>
					<h:panelGroup />
				</h:panelGrid>
				<h:panelGrid columns="3" width="70%">
					<h:outputLabel value="#{msgs.cpf}#{msgs.dois_pontos}" />
					<h:outputLabel value="#{msgs.rg}#{msgs.dois_pontos}" />
					<h:outputLabel value="#{msgs.estado_civil}#{msgs.dois_pontos}" />

					<p:inputText id="cpf" value="#{professorBean.professor.cpf}"
						maxlength="20" required="true">
						<p:message for="cpf" />
					</p:inputText>
					<p:inputText id="rg" value="#{professorBean.professor.rg}"
						maxlength="20" required="true">
						<p:message for="rg" />
					</p:inputText>
					<h:selectOneMenu value="#{professorBean.idEstadoCivil}"
						id="estado_civil">
						<f:selectItem itemLabel="SELECIONE" itemValue="0" />
						<f:selectItems value="#{professorBean.selectItensEstadosCivis}"
							var="estadoCivil" itemLabel="#{estadoCivil.descEstadoCivil}"
							itemValue="#{estadoCivil.idestadoCivil}" />
						<f:validator
							validatorId="br.com.pirralhos.view.validation.ComboValidator" />
						<p:message for="estado_civil" />
					</h:selectOneMenu>
					<h:outputLabel
						value="#{msgs.telefone_residencial}#{msgs.dois_pontos}" />
					<h:outputLabel value="#{msgs.telefone_creche}#{msgs.dois_pontos}" />
					<h:panelGroup />
					<p:inputMask id="telefoneResidencial"
						value="#{professorBean.professor.telefoneResidencial}"
						maxlength="20" mask="(99)9999-9999" />
					<h:selectOneMenu value="#{professorBean.idTelefoneCreche}"
						id="telefone_creche"> 
						<f:selectItem itemLabel="SELECIONE" itemValue="0" />
						<f:selectItems value="#{professorBean.selectItensTelefonesCreche}"
							var="telefoneCreche" itemLabel="#{telefoneCreche.numero}"
							itemValue="#{telefoneCreche.idtelefoneCreche}" />
						<f:validator
							validatorId="br.com.pirralhos.view.validation.ComboValidator" />
						<p:message for="telefone_creche" />
					</h:selectOneMenu>
					<h:panelGroup />
				</h:panelGrid>
				<h:panelGrid columns="3" width="90%"> 
					<h:outputLabel value="#{msgs.email}#{msgs.dois_pontos}" />
					<h:outputLabel value="#{msgs.sexo}#{msgs.dois_pontos}"
						style="margin-right:217px" />
					<h:panelGroup />
					<p:inputText id="email" value="#{professorBean.professor.email}" 
						maxlength="75" size="50">
						<f:validator
							validatorId="br.com.pirralhos.view.validation.EmailValidator" />
					</p:inputText>
					<h:selectOneMenu value="#{professorBean.idSexo}" id="sexo">
						<f:selectItem itemLabel="SELECIONE" itemValue="0" />
						<f:selectItems value="#{sexoBean.listaSexos}" var="sexo"
							itemLabel="#{sexo.descSexo}" itemValue="#{sexo.idsexo}" /> 
						<f:validator
							validatorId="br.com.pirralhos.view.validation.ComboValidator" />
						<p:message for="sexo" />
					</h:selectOneMenu>
					<h:panelGroup />
				</h:panelGrid>
			</p:fieldset>
			<p:fieldset legend="#{msgs.dados_endereco}">
				<h:panelGrid columns="3" width="90%">
					<h:outputLabel value="#{msgs.endereco}#{msgs.dois_pontos}" />
					<h:outputLabel value="#{msgs.numero}#{msgs.dois_pontos}"
						style="margin-right:200px" />
					<h:panelGroup />
					<p:inputText id="endereco"
						value="#{professorBean.professor.endereco}" maxlength="75"
						size="50" required="true">
						<p:message for="endereco" />
					</p:inputText>
					<p:inputText id="numero" value="#{professorBean.professor.numero}"
						maxlength="10" required="true">
						<p:message for="numero" />
					</p:inputText>
					<h:panelGroup />
				</h:panelGrid>
				<h:panelGrid columns="3" width="70%">
					<h:outputLabel value="#{msgs.complemento}#{msgs.dois_pontos}" />
					<h:outputLabel value="#{msgs.cep}#{msgs.dois_pontos}" />
					<h:outputLabel value="#{msgs.estado}#{msgs.dois_pontos}" />
					<p:inputText id="complemento"
						value="#{professorBean.professor.complemento}" maxlength="20">
					</p:inputText>
					<p:inputText id="cep" value="#{professorBean.professor.cep}"
						maxlength="20" required="true">
						<p:message for="cep" />
					</p:inputText>
					<h:selectOneMenu value="#{professorBean.idEstado}" id="estado">
						<f:selectItem itemLabel="SELECIONE" itemValue="0" />
						<f:selectItems value="#{professorBean.selectItensEstados}" />
						<p:ajax listener="#{professorBean.popularCidade}" update="cidades"
							process="@this" />
						<f:validator
							validatorId="br.com.pirralhos.view.validation.ComboValidator" />
						<p:message for="estado" />
					</h:selectOneMenu>
					<h:outputLabel value="#{msgs.cidade}#{msgs.dois_pontos}" />
					<h:outputLabel value="#{msgs.bairro}#{msgs.dois_pontos}" />
					<h:panelGroup />
					<h:selectOneMenu value="#{professorBean.idCidade}" id="cidades"
						disabled="#{empty professorBean.selectItensCidades}">
						<f:selectItem itemLabel="SELECIONE" itemValue="0" />
						<f:selectItems value="#{professorBean.selectItensCidades}" />
						<f:validator
							validatorId="br.com.pirralhos.view.validation.ComboValidator" />
						<p:message for="cidades" />
					</h:selectOneMenu>
					<p:inputText id="bairro" value="#{professorBean.professor.bairro}"
						maxlength="50" required="true">
						<p:message for="bairro" />
					</p:inputText>
				</h:panelGrid>
			</p:fieldset>
			<p:fieldset legend="#{msgs.dados_contrato}">
				<h:panelGrid columns="2" width="70%">
					<h:outputLabel value="#{msgs.data_admissao}#{msgs.dois_pontos}" />
					<h:outputLabel value="#{msgs.data_saida}#{msgs.dois_pontos}" />
					<p:calendar id="dataAdmissao"
						value="#{professorBean.professor.dataAdmissao}" locale="pt_Br"
						navigator="true" showButtonPanel="true" required="true">
						<p:message for="dataAdmissao" />
					</p:calendar>
					<p:calendar value="#{professorBean.professor.dataSaida}"
						locale="pt_Br" navigator="true" showButtonPanel="true" />
				</h:panelGrid>
			</p:fieldset>
			<p:fieldset legend="#{msgs.dados_usuario}">
				<h:panelGrid columns="2" width="50%">
					<h:outputLabel value="#{msgs.login}#{msgs.dois_pontos}" />
					<p:inputText id="login" value="#{professorBean.login}"
						maxlength="20" required="true">
						<p:message for="login"  />	
						<p:ajax update="botoes,usuarioValido" />
					</p:inputText>
					<h:outputLabel id="usuarioValido" value="#{professorBean.usuarioValido}" style="color:red"/>
				</h:panelGrid>
				<h:panelGrid id="botoes" styleClass="painelBotoes" columns="3">
					<p:commandButton value="#{msgs.botao_confirmar}"
						disabled="#{not empty professorBean.usuarioValido}"
						update="formCadastroProfessor" action="#{professorBean.gravar}"
						ajax="false" />
				</h:panelGrid>
			</p:fieldset>
		</h:form>
	</ui:define>
</ui:composition>
